USE Northgale
go
SET NOCOUNT ON
go
PRINT 'Searching for ERNTC in a single day: '
go
DECLARE @d2 datetime2(3) = sysdatetime()
EXEC static_search_4 @custid = 'ERNTC',
                     @fromdate = '19980218', @todate = '19980218'
PRINT concat('static_search_4: ', datediff(ms, @d2, sysdatetime()), ' ms.')
go
DECLARE @d2 datetime2(3) = sysdatetime()
EXEC dynamic_search_1 @custid = 'ERNTC',
                      @fromdate = '19980218', @todate = '19980218'
PRINT concat('dynamic_search_1: ', datediff(ms, @d2, sysdatetime()), ' ms.')
go
DECLARE @d2 datetime2(3) = sysdatetime()
EXEC dynamic_search_bad @custid = 'ERNTC',
                        @fromdate = '19980218', @todate = '19980218'
PRINT concat('dynamic_search_bad: ', datediff(ms, @d2, sysdatetime()), ' ms.')
go

PRINT ''
PRINT 'Searching for BOLSR in a full year: '
DECLARE @d2 datetime2(3) = sysdatetime()
EXEC static_search_4 @custid = 'BOLSR',
                     @fromdate = '19980101', @todate = '19981231'
PRINT concat('static_search_4: ', datediff(ms, @d2, sysdatetime()), ' ms.')
go
DECLARE @d2 datetime2(3) = sysdatetime()
EXEC dynamic_search_1 @custid = 'BOLSR',
                      @fromdate = '19980101', @todate = '19981231'
PRINT concat('dynamic_search_1: ', datediff(ms, @d2, sysdatetime()), ' ms.')
go
DECLARE @d2 datetime2(3) = sysdatetime()
EXEC dynamic_search_bad @custid = 'BOLSR',
                        @fromdate = '19980101', @todate = '19981231'
PRINT concat('dynamic_search_bad: ', datediff(ms, @d2, sysdatetime()), ' ms.')
go
